//
//  OtherSettingViewController.m
//  SIPphone
//
//  Created by wrt on 13-11-22.
//  Copyright (c) 2013年 wrtsoft. All rights reserved.
//

#import "OtherSettingViewController.h"

@interface OtherSettingViewController ()

@end

@implementation OtherSettingViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
        self.title = NSLocalizedString(@"other settings", @"其他配置 Other settings");
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    
    //是否开启状态显示
    NSString *isOpenAutoCallStatusDetail = [[NSString alloc] init];
    isOpenAutoCallStatusDetail = [defaults objectForKey:@"SAVEISDISPLAYCALLSTATUS"];
    if (isOpenAutoCallStatusDetail.length > 0)
    {
        if ([isOpenAutoCallStatusDetail isEqualToString:@"YES"])
        {
            [self.displayCallStatus setOn:YES];
        }
        else if ([isOpenAutoCallStatusDetail isEqualToString:@"NO"])
        {
            [self.displayCallStatus setOn:NO];
        }
    }
}

- (IBAction)displayCallStatusSwitchSelect:(id)sender
{
    UISwitch *switchControl = (UISwitch *)sender;
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    BOOL isDisplayCallStatus = switchControl.on;
    if (isDisplayCallStatus == YES)
    {
        [defaults setObject:@"YES" forKey:@"SAVEISDISPLAYCALLSTATUS"];
    }
    else
    {
        [defaults setObject:@"NO" forKey:@"SAVEISDISPLAYCALLSTATUS"];
    }
    [defaults synchronize];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
